package com.example.springspel.service;

import com.example.springspel.dao.PermissionRepository;
import com.example.springspel.entity.Permission;
import com.example.springspel.entity.User;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionService {

  private final PermissionRepository permissionRepository ;
  public PermissionService(PermissionRepository permissionRepository) {
    this.permissionRepository = permissionRepository ;
  }

  public List<Permission> findPermissions(Long userId) {
    return this.permissionRepository.findByUser(new User(userId)) ;
  }
}